Repository navigation
Sign in with named profiles, one account each - #164
Merged
Merged
Conversation
The CLI now keeps profiles instead of hosts: a profile has a name of its own and bundles a host, a token and the account it acted as. A command picks one with --profile or $MINKA_PROFILE, or by host with --host or $MINKA_HOST, else it uses the default profile. "profiles list", "rename", "remove" and "default" manage them, and "auth status" and "doctor" name the active profile and where the choice came from. Previously, the configuration held one token per host. Switching between organizations meant typing the full address, and two accounts on one host could not exist side by side. A host still works as a way to choose: it stands for its one profile, or for the default among several, and refuses to guess otherwise. A sign-out by host follows the same rule, so it never removes or revokes one of two accounts by chance. $MINKA_TOKEN keeps going only to $MINKA_HOST and never to a named profile, which may be another account on the same host; a notice says when it was passed over. An existing file is taken over on load: every host becomes a profile named after it, and the default host the default profile. A plain read never rewrites it. When this version saves, it writes the hosts and the default host beside the profiles, so an older minka still signs in. An older minka that writes the file drops the profiles, though. The next read then takes its hosts over again, so no sign-in is lost, but the profile names and any second account on a host are. The cards of "work start" are kept per account now, so two accounts on one host do not report each other's cards. A store kept per host goes to the profile its host stands for, and the store keeps per host the lists of that profile beside the accounts, for an older minka. Removing a profile drops its lists, so that a later profile of the same name on another host never reports them with its token. Lists that a failed move or drop leaves under a name no profile has are passed over, and a new profile clears its name in the store before it is saved. Nothing deletes them merely because the configuration lacks the name, since a command may read the configuration in the middle of a rename. The heartbeat runs from the mod with the environment Claude Code was started with, so it reports every account that holds a list of its session, each with its own token, rather than only the default one. The read marks of comments and the positions of notifications were already kept per token and stay as they are. Resolves: https://minka.flownative.com/go/card/MNK-TP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The CLI now keeps named profiles instead of hosts, so you can switch between organizations without typing the full address:
--profile flownative,--profile familie. A profile bundles a host, a token and the account they sign in as. Several profiles may point to the same host, for example two accounts in one organization.Choosing a profile, strongest first:
--profile, then--host(both together are a usage error); then$MINKA_PROFILE, then$MINKA_HOST; then the default profile. A host that several profiles point to takes the default profile if it is one of them, and otherwise stops with exit 8, naming the profiles.$MINKA_HOSTwith$MINKA_TOKENand no config file works as before. When a profile wins over a set$MINKA_TOKEN, a notice says the token was not used.Commands
auth login [--profile <name>]creates a profile or signs an existing one in again. Without--profileit behaves as before, and the first profile becomes the default.profiles list,profiles rename,profiles remove [--revoke]andprofiles default.auth logoutremoves the active profile.config set hostmakes the profile on that host the default.auth statusanddoctorname the active profile;auth statusalso says where the choice came from. The JSON fields are added, not renamed.Existing configurations need nothing done: every host becomes a profile named after the host, and the default host becomes the default profile. A plain read never rewrites the file. A save writes
profilesand also mirrorshosts/defaultHost, so older minka versions keep reading the file. The work store, with the lists behind the heartbeat, is kept per profile and mirrored the same way.For the release notes: an older version that writes the file keeps every sign-in, but loses the profile names and any second account on the same host.
Register: C-191 to C-196, with C-044 and C-179 to C-181 rewritten for profiles; the rules are in
docs/stable/profiles.md. Checked against the fake and with a built binary on temporary config files only, not live yet. An independent review ran over several rounds, with every finding fixed, among them a sign-out by host that took the wrong profile on a shared host. Each safeguard has a test and a sabotage proof.Resolves: https://minka.flownative.com/go/card/MNK-TP